import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';

export default function getCrossTransData() {
    const {transType, orgVal, editTable, func_type} = this.props;
    const {transState} = this.state;
    let postData = {
        func_type,
        inout: transType,
        pk_org: orgVal.refpk,
        transstate: transState
    };

    return proFetch({
        url: '/nccloud/hrtrn/pub/RecordsPsntransterQueryAction.do',
        body: postData,
    })
        .then((res) => {
            if (res.success) {
                const tableKey = 'hi_psntranster' + transState;
                if (!res.data) {
                    editTable.setTableData(tableKey, {
                        rows: []
                    });
                } else {
                    editTable.setTableData(tableKey, {
                        rows: res.data[tableKey].rows
                    });
                }
            }
        });
}
